import { Button, Modal, Form, Input, Row, Select, Col, DatePicker, Space } from 'antd';
import React, { useState } from 'react';
import ItemFrom from './ItemFrom';

const Tbutton = function (props) {
  const [visible, setVisible] = useState(false);
  const { methods, rowInfo,isuse,children} = props
  const getChildrenValue = (value,id) => {
    methods(value,id)
  }
  //弹出框的显示隐藏
  const showModal = () => {
    //改变item的值
    setVisible(true)
  };

  return (
    <>
      <Button type="primary"
        onClick={showModal}
        disabled={isuse}
        style={{
          color: '#1890ff',
          border: '1px solid #1890ff',
          marginRight: '10px',
          backgroundColor: '#fff'
        }}>
        {children}
      </Button>
      {
        visible?
        <ItemFrom visible={visible} heardtitle={children} getChildrenValue={getChildrenValue} setVisible={setVisible} rowInfo={rowInfo}></ItemFrom>
        :null
      }
    </>
  );
};

export default Tbutton;